package com.sangmo.fts.training.repo;

import com.sangmo.boot.framework.plugin.dataview.spi.jpa.IJpaDataViewRepo;
import com.sangmo.fts.training.model.TrainingHistory;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TrainingHistoryRepo extends IJpaDataViewRepo<TrainingHistory> {

    @Query(value = "SELECT a from TrainingHistory a where a.trainingId = :trainingId group by a.processNode")
    List<TrainingHistory> findByTrainingIdGroupByProcessNode(@Param("trainingId") Long trainingId);
}
